import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;



public class Tracker {
	private final HashMap<String, Point> map = new HashMap<String, Point>();
	public Point getLocation(String id) {
		synchronized(map) {
			Point point = new Point(map.get(id));
			return point;
		}
	}
	public void setLocation(String id, double x, double y) {
		synchronized(map) {
			Point point = new Point(x, y);
			map.put(id, point);
		}
	}
	public HashMap<String, Point> getLocations() {
		synchronized(map) {
			HashMap<String, Point> mapHelp = new HashMap<String, Point>();
			Iterator iter = map.entrySet().iterator();
			int i = 0;
			while (iter.hasNext()) {
				i++;
				Map.Entry pairs = (Map.Entry)iter.next();
				mapHelp.put((String)pairs.getKey(), (Point)pairs.getValue());
			}
			return mapHelp;
		}
	}
}
